package ee.graphicscard.controller.graphicscardcontroller;

import org.apache.log4j.Logger;

import ee.graphicscard.controller.Command;

public class GraphicsCardCommandFactory 
{
	private Logger logger = Logger.getLogger(GraphicsCardCommandFactory.class);
	public Command getCommand(String commandDescription)
	{
		Command command = null;
		
		try 
		{
			if (commandDescription.equals("default"))
			{
				command = new GetAllGraphicsCardsCommand();
			}
			
			if (commandDescription.equals("show_graphics_card_by_id"))
			{
				command = new GetGraphicsCardById();
			}
			
			if (commandDescription.equals("save_graphics_card_update"))
			{
				command = new SaveGraphicsCardUpdate();
			}
		}
		catch (Exception e) 
		{
			logger.warn(e.getMessage());
		}
		
		return command;
	}
}
